<html>

<head>

<?php

$time_start = microtime(true);
@include "../includes/constants.php";
@include "../includes/functions.php";
$cell_size = "40";

if ($_GET[id]) {
	@include "../includes/profile.php";
	echo "<title>EQ Emu - " . $Profile[name] . "'s Inventory</title>\n";
} else {
	echo "<title>EQ Emu - Character Inventory</title>\n";
};

?>

<script src="../includes/functions.js"></script>

<link rel="stylesheet" type="text/css" href="inventory.css">

</head>

<body>

<?php

if ($_GET[id]) {

$query_level = "SELECT level FROM character_ WHERE id=" . $_GET[id];
$result_level = mysql_query($query_level,$db);
$db_row_level = mysql_fetch_array($result_level);

$BaseStats = array(
	str => $Profile[STR],
	sta => $Profile[STA],
	agi => $Profile[AGI],
	dex => $Profile[DEX],
	wis => $Profile[WIS],
	int => $Profile[INT],
	cha => $Profile[CHA],
	poison => 15,
	magic => 25,
	disease => 15,
	fire => 25,
	cold => 25
);
$Stats[hp] = GetStatsFromArmor("hp");
$Stats[mana] = GetStatsFromArmor("mana");
$Stats[endur] = GetStatsFromArmor("endur");
$Stats[ac] = GetStatsFromArmor("ac") + 0;	// See zone/client_mods.cpp
$Stats[atk] = GetStatsFromArmor("attack");
$Stats[str] = GetStatsFromArmor("astr") + $BaseStats["str"];
$Stats[sta] = GetStatsFromArmor("asta") + $BaseStats["sta"];
$Stats[agi] = GetStatsFromArmor("aagi") + $BaseStats["agi"];
$Stats[dex] = GetStatsFromArmor("adex") + $BaseStats["dex"];
$Stats[wis] = GetStatsFromArmor("awis") + $BaseStats["wis"];
$Stats["int"] = GetStatsFromArmor("aint") + $BaseStats["int"];
$Stats[cha] = GetStatsFromArmor("acha") + $BaseStats["cha"];
$Stats[poison] = GetStatsFromArmor("pr") + $BaseStats["poison"] + $StatsModClass[$Profile["class"]]["pr"] + $StatsModRace[$Profile["race"]]["pr"];
$Stats[magic] = GetStatsFromArmor("mr") + $BaseStats["magic"] + $StatsModClass[$Profile["class"]]["mr"] + $StatsModRace[$Profile["race"]]["mr"];
$Stats[disease] = GetStatsFromArmor("dr") + $BaseStats["disease"] + $StatsModClass[$Profile["class"]]["dr"] + $StatsModRace[$Profile["race"]]["dr"];
$Stats[fire] = GetStatsFromArmor("fr") + $BaseStats["fire"] + $StatsModClass[$Profile["class"]]["fr"] + $StatsModRace[$Profile["race"]]["fr"];
$Stats[cold] = GetStatsFromArmor("cr") + $BaseStats["cold"] + $StatsModClass[$Profile["class"]]["cr"] + $StatsModRace[$Profile["race"]]["cr"];
$Stats[weight] = GetStatsFromArmor("weight") / 10;

function OutputStatCSSClass($StatName) {
	global $Stats;
	global $BaseStats;
	if ($Stats[$StatName] > $BaseStats[$StatName]) {
		echo " class=\"stat_pos\"";
	} elseif ($Stats[$StatName] < $BaseStats[$StatName]) {
		echo " class=\"stat_neg\"";
	} else {
		echo " class=\"\"";
	};
};

?>

<table border="0">
<!--
	<tr>
		<td colspan="3">
			<font id="CategoryAct">Inventory</font>
			<font id="CategoryInact">Evolving Items</font>
			<font id="CategoryInact">Shroud Progression</font>
		</td>
	</tr>
-->
	<tr>
		<td valign="top">
			<?php echo $Profile[name];?><br>
			<?php echo $db_row_level[level] . " " . $Classes[$Profile["class"]];?><br>
			<?php echo $Deities[$Profile[diety]];?><br>
			<hr style="height: 0px; color: #0000;">
			<table cellpadding="0" cellspacing="0">
				<tr>
					<td>HP</td>
					<td>&nbsp;&nbsp;</td>
					<td align="center"><?php echo $Profile[cur_hp];?> / <?php echo $Stats[hp];?></td>
				</tr>
				<tr>
					<td>MANA</td>
					<td>&nbsp;&nbsp;</td>
					<td align="center"><?php echo $Profile[mana];?> / <?php echo $Stats[mana];?></td>
				</tr>
				<tr>
					<td>ENDR</td>
					<td>&nbsp;&nbsp;</td>
					<td align="center"><?php echo $Profile[endurance];?> / <?php echo $Stats[endur];?></td>
				</tr>
				<tr>
					<td>AC</td>
					<td>&nbsp;&nbsp;</td>
					<td align="center"><?php echo $Stats[ac];?></td>
				</tr>
				<tr>
					<td>ATK</td>
					<td>&nbsp;&nbsp;</td>
					<td align="center"><?php echo $Stats[atk];?></td>
				</tr>
			</table>
			<hr style="height: 0px; color: #0000;">
			NEXT LEVEL<br>
			<center><?php echo $Profile[exp];?></center>
			ALT. ADV.<br>
			<center><?php echo $Profile[expAA];?></center>
			<hr style="height: 0px; color: #0000;">
			<table cellpadding="0" cellspacing="0">
				<tr>
					<td>STR</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(str);?>><?php echo $Stats[str];?></td>
				</tr>
				<tr>
					<td>STA</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(sta);?>><?php echo $Stats[sta];?></td>
				</tr>
				<tr>
					<td>AGI</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(agi);?>><?php echo $Stats[agi];?></td>
				</tr>
				<tr>
					<td>DEX</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(dex);?>><?php echo $Stats[dex];?></td>
				</tr>
			</table>
			<hr style="height: 0px; color: #0000;">
			<table cellpadding="0" cellspacing="0">
				<tr>
					<td>WIS</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(wis);?>><?php echo $Stats[wis];?></td>
				</tr>
				<tr>
					<td>INT</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass("int");?>><?php echo $Stats["int"];?></td>
				</tr>
				<tr>
					<td>CHA</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(cha);?>><?php echo $Stats[cha];?></td>
				</tr>
			</table>
			<hr style="height: 0px; color: #0000;">
			<table cellpadding="0" cellspacing="0">
				<tr>
					<td>POISON</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(poison);?>><?php echo $Stats[poison];?></td>
				</tr>
				<tr>
					<td>MAGIC</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(magic);?>><?php echo $Stats[magic];?></td>
				</tr>
				<tr>
					<td>DISEASE</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(disease);?>><?php echo $Stats[disease];?></td>
				</tr>
				<tr>
					<td>FIRE</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(fire);?>><?php echo $Stats[fire];?></td>
				</tr>
				<tr>
					<td>COLD</td>
					<td>&nbsp;&nbsp;</td>
					<td<?php OutputStatCSSClass(cold);?>><?php echo $Stats[cold];?></td>
				</tr>
			</table>
			<hr style="height: 0px; color: #0000;">
		</td>
		<td valign="top" align="center">
			<table border="0">
				<tr>
					<td id="slot_ear" title="Left Ear"><?php GetSlotInfo(1);?></td>
					<td id="slot_head" title="Head"><?php GetSlotInfo(2);?></td>
					<td id="slot_face" title="Face"><?php GetSlotInfo(3);?></td>
					<td id="slot_ear" title="Right Ear"><?php GetSlotInfo(4);?></td>
				</tr>
				<tr>
					<td id="slot_chest" title="Chest"><?php GetSlotInfo(17);?></td>
					<td id="class_ani" colspan="2" rowspan="4"><img height="164" width="81" src="../images/class_ani-<?php echo strtolower($Classes[$Profile["class"]]);?>.gif" alt="<?php echo $Classes[$Profile["class"]];?>"></td>
					<td id="slot_neck" title="Neck"><?php GetSlotInfo(5);?></td>
				</tr>
				<tr>
					<td id="slot_arms" title="Arms"><?php GetSlotInfo(7);?></td>
					<td id="slot_back" title="Back"><?php GetSlotInfo(8);?></td>
				</tr>
				<tr>
					<td id="slot_waist" title="Waist"><?php GetSlotInfo(20);?></td>
					<td id="slot_shoulders" title="Shoulders"><?php GetSlotInfo(6);?></td>
				</tr>
				<tr>
					<td id="slot_wrist" title="Left Wrist"><?php GetSlotInfo(9);?></td>
					<td id="slot_wrist" title="Right Wrist"><?php GetSlotInfo(10);?></td>
				</tr>
				<tr>
					<td id="slot_legs" title="Legs"><?php GetSlotInfo(18);?></td>
					<td id="slot_hands" title="Hands"><?php GetSlotInfo(12);?></td>
					<td id="slot_charm" title="Charm"><?php GetSlotInfo(0);?></td>
					<td id="slot_feet" title="Feet"><?php GetSlotInfo(19);?></td>
				</tr>
				<tr>
					<td></td>
					<td id="slot_ring" title="Left Ring"><?php GetSlotInfo(15);?></td>
					<td id="slot_ring" title="Right Ring"><?php GetSlotInfo(16);?></td>
					<td></td>
				</tr>
				<tr>
					<td id="slot_primary" title="Primary"><?php GetSlotInfo(13);?></td>
					<td id="slot_secondary" title="Secondary"><?php GetSlotInfo(14);?></td>
					<td id="slot_range" title="Range"><?php GetSlotInfo(11);?></td>
					<td id="slot_ammo" title="Ammo"><?php GetSlotInfo(21);?></td>
				</tr>
			</table>
		</td>
		<td rowspan="2" valign="top">
			<table border="0" cellpadding="1" cellspacing="">
				<tr>
					<td colspan="2" nowrap>Radiant Crystals</td>
				</tr>
				<tr>
					<td title="Radiant Crystals" id="money" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="20" width="18" src="../images/radiant_crystals.gif">&nbsp;
						<?php echo $Profile[currentRadCrystals] . "\n";?>
					</td>
				</tr>
				<tr>
					<td colspan="2" nowrap>Ebon Crystals</td>
				</tr>
				<tr>
					<td title="Ebon Crystals" id="money" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="20" width="18" src="../images/ebon_crystals.gif">&nbsp;
						<?php echo $Profile[currentEbonCrystals] . "\n";?>
					</td>
				</tr>
				<tr>
					<td colspan="2"><button name="Reclaim" style="width: 90%" onclick="this.blur()" onMouseOver="this.className='act'" onMouseOut="this.className='inact'">Reclaim</button></td>
				</tr>
				<tr id="money">
					<td title="Platinum" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="16" width="16" src="../images/platinum.gif">&nbsp;
						<?php echo $Profile[platinum] . "\n";?>
					</td>
				</tr>
				<tr id="money">
					<td title="Gold" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="18" width="18" src="../images/gold.gif">&nbsp;
						<?php echo $Profile[gold] . "\n";?>
					</td>
				</tr>
				<tr id="money">
					<td title="Silver" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="18" width="18" src="../images/silver.gif">&nbsp;
						<?php echo $Profile[silver] . "\n";?>
					</td>
				</tr>
				<tr id="money">
					<td title="Copper" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" nowrap>
						<img height="18" width="18" src="../images/copper.gif">&nbsp;
						<?php echo $Profile[copper] . "\n";?>
					</td>
				</tr>
			</table>
			<table border="0">
				<tr>
					<td id="slot_inv" title="Inventory Slot 1"><?php GetSlotInfo(22);?></td>
					<td id="slot_inv" title="Inventory Slot 5"><?php GetSlotInfo(26);?></td>
				</tr>
				<tr>
					<td id="slot_inv" title="Inventory Slot 2"><?php GetSlotInfo(23);?></td>
					<td id="slot_inv" title="Inventory Slot 6"><?php GetSlotInfo(27);?></td>
				</tr>
				<tr>
					<td id="slot_inv" title="Inventory Slot 3"><?php GetSlotInfo(24);?></td>
					<td id="slot_inv" title="Inventory Slot 7"><?php GetSlotInfo(28);?></td>
				</tr>
				<tr>
					<td id="slot_inv" title="Inventory Slot 4"><?php GetSlotInfo(25);?></td>
					<td id="slot_inv" title="Inventory Slot 8"><?php GetSlotInfo(29);?></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2" valign="top">
			WEIGHT&nbsp;&nbsp;&nbsp;<?php echo ceil($Stats[weight]);?>/<?php echo $Stats[str];?><br><br>
			<button name="Skills" onclick="this.blur();OpenSkills('<?php echo $_GET[id];?>')" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" >Skills</button>&nbsp;
			<button name="AltAdv" onclick="this.blur();OpenAA('<?php echo $_GET[id];?>','<?php echo $Profile["class"]?>')" onMouseOver="this.className='act'" onMouseOut="this.className='inact'" >Alt. Adv.</button>&nbsp;
			<button name="Face" onclick="this.blur()" onMouseOver="this.className='act'" onMouseOut="this.className='inact'">Face</button>&nbsp;
			<button name="Dye" onclick="this.blur()" onMouseOver="this.className='act'" onMouseOut="this.className='inact'">Dye</button>&nbsp;
			<button name="Destroy" onclick="this.blur()" onMouseOver="this.className='act'" onMouseOut="this.className='inact'">Destroy</button>&nbsp;
			<button name="Done" onclick="blur();history.back();" onMouseOver="this.className='act'" onMouseOut="this.className='inact'">Done</button>
		</td>
	</tr>
</table>
<br>
<a href="bank.php?id=<?php echo $_GET[id]?>" target="Bank" onclick="OpenBank('<?php echo $_GET[id]?>')">Bank</a>
<a href="buffs.php?id=<?php echo $_GET[id]?>" target="Buffs" onclick="OpenBuffs('<?php echo $_GET[id]?>')">Buffs</a>
<a href="memspells.php?id=<?php echo $_GET[id]?>" target="MemSpells" onclick="OpenMemSpells('<?php echo $_GET[id]?>')">Memorized Spells</a>
<a href="spellbook.php?id=<?php echo $_GET[id]?>" target="SpellBook" onclick="OpenSpellBook('<?php echo $_GET[id]?>')">Spell Book</a>
<a href="questglobals.php?id=<?php echo $_GET[id]?>" target="QuestGlobals" onclick="">Quest Globals</a>
<a href="zoneflags.php?id=<?php echo $_GET[id]?>" target="ZoneFlags" onclick="">Zone Flags</a>
<a href="pet.php?id=<?php echo $_GET[id]?>" target="Pet" onclick="">Pet</a>
<br>
<br>
DOB: <?php echo date("Y-m-d @ H:i:s",$Profile[birthday]) . "<br>\n";?>

<?php

flush(); ob_flush();

echo "<pre style=\"color:black\">\n\n";
print_r($Profile);
echo "\n";
print_r($ExtProfile);
echo "</pre>";

} else {
	echo "<form name=\"NoID\" method=\"GET\" action=\"\">Enter ID: <input type=\"text\" name=\"id\" size=\"2\"><br>\n";
};

include "../includes/footer.php";

?>

</body>

</html>